<jsp:useBean id="data" class="JEE.Bean" scope="session"></jsp:useBean>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page language="java" import="JEE.Login"%>

<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Page </title>



</head>
<body onload="get()">
<div style="height: 75vh; width: 100%; text-align:center;">
  <%
    Cookie[] cookies = request.getCookies();
    data.setUserName(null);
    data.setUserPsd(null);
    for (Cookie cookie : cookies) {
      if (cookie.getName().equals("name")){
        data.setUserName(cookie.getValue());
        data.setCheckd("true");
      }

      if (cookie.getName().equals("psd"))
        data.setUserPsd(cookie.getValue());
    }
  %>

  <script>
    function get() {
      var temp = "<%=data.getUserName()%>"
      if(temp != "null")
        document.getElementById('box').checked = true;
      else
        document
    }

  </script>

  <form action="JEE.Login" method="get">
    Account &nbsp;
    <input type="text" name="name" id="name" value=${data.userName}>
    PassWord &nbsp;
    <input type="password" name="psd" id="psd" value=${data.userPsd}>
    <br>
    Keep &nbsp;
    <input type="checkbox" name="box" id="box">
    <br><br>
    <button type="submit">Submit</button> &nbsp;&nbsp;
    <button type="reset">Reset</button>
  </form>
  <br>
</div>
</body>
</html>
